home *** CD-ROM | disk | FTP | other *** search
- Const WindowsFolder = 0
- Const OKOnly = 0
- Const Critical = 16
- Const Exclamation = 48
- Const PROGRAM_FILES = &H26&
-
-
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Function: LogInfo
- ' Params: msg - Value to be sent to debug stream
- ' Description: Logs information to debug stream
- ' Returns: Nothing
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Function LogInfo(msg)
- Dim rec
- Set rec = Session.Installer.CreateRecord(1)
- rec.StringData(0) = "LogInfo:" & msg
- LogInfo = Session.Message(&H04000000, rec)
- End Function
-
- Function SetProgramFiles
- On Error Resume Next
- LogInfo("Setting default directory to 'Program Files'")
- Set objShell = CreateObject("Wscript.Shell")
- if objShell is Nothing then
- LogInfo("Unable to create wscript.shell")
- end if
- Set shellApp = CreateObject("Shell.Application")
- if shellApp is Nothing then
- LogInfo("Unable to create Shell.Application")
- end if
- Set objFolder = shellApp.Namespace(PROGRAM_FILES)
- if objFolder is Nothing then
- LogInfo("Unable to get objShell.Namespace(PROGRAM_FILES)")
- end if
- Set objFolderItem = objFolder.Self
- if objFolderItem is Nothing then
- LogInfo("Unable to get Set objFolderItem = objFolder.Self")
- end if
- objShell.CurrentDirectory = objFolderItem.Path
- LogInfo("Setting Default Working Directory to " & objFolderItem.Path)
- set objShell = Nothing
- set shellApp = Nothing
- set objFolder = Nothing
- set objFolderItem = Nothing
- End Function
-
-
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Function: CheckNextTarget
- ' Params: N/A
- ' Description: Checks path validity
- ' Returns: Success or Failure
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Function CheckNextTarget
- On Error Resume Next
-
- SetProgramFiles
- path = Session.Property("TARGETDIR")
-
- Set fs=CreateObject("Scripting.FileSystemObject")
- LogInfo "CheckNextTargetPath {" & path & "}"
- If fs.FolderExists(path) Then
- Session.Property("NextValidTarget") = "True"
- CheckNextTarget = True
- LogInfo "CheckNextTarget Function Result {" & CheckNextTarget & "}"
- set fs = Nothing
- Exit Function
- End If
- fs.CreateFolder(path)
- CheckNextTarget = fs.FolderExists(path)
- Session.Property("NextValidTarget")=CStr(CheckNextTarget)
- If CheckNextTarget Then
- Session.Property("TARGETDIR")=fs.GetFolder(path).Path
- fs.DeleteFolder(path)
- End If
- set fs=Nothing
- LogInfo " CheckNextTarget Function Result {" & CheckNextTarget & "}"
- End Function
-
-
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Function: VerifyBrowseTarget
- ' Params: N/A
- ' Description: Called by browse button for a valid starting point
- ' Returns: Success or Failure
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Function VerifyBrowseTarget
-
- LogInfo "Running VerifyBrowseTarget"
-
- If CheckNextTarget Then
- LogInfo "Should be set to:" & Session.Property("TARGETDIR")
- Exit Function
- End If
- Session.Property("NextValidTarget") = "True"
- Set fs=CreateObject("Scripting.FileSystemObject")
- Session.Property("TARGETDIR")= CreateObject("WScript.Shell").ExpandEnvironmentStrings("%PROGRAMFILES%")& "\" & Session.Property("Name")
- LogInfo "Invalid path entered, resetting to " & Session.Property("TARGETDIR")
- Set fs= Nothing
- End Function
-
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Function: VerifyNextTarget
- ' Params: N/A
- ' Description: Called by next button for a valid install point
- ' Returns: Success or Failure
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Function VerifyNextTarget
-
- LogInfo "Running VerifyNextTarget"
-
- If CheckNextTarget Then
- Exit Function
- End If
- MsgBox Session.Property("InvalidTarget"), Critical Or OKOnly, Session.Property("Name")
- End Function
-
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Function: VerifyNextCustomInstall
- ' Params: N/A
- ' Description: Called by next button for a valid custom installation
- ' Returns: Nothing
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Function VerifyNextCustomInstall
-
- LogInfo "Running VerifyNextCustomInstall"
-
- Session.Property("NextValidCustomInstall") = "True"
-
- if Session.Property("Installed") <> "" Then Exit Function
-
- If Session.FeatureRequestState("CrashAnalyzer") <> 3 And Session.FeatureRequestState("ERDCommander") <> 3 And _
- Session.FeatureRequestState("FileRestore") <> 3 Then
- Session.Property("NextValidCustomInstall") = "False"
- MsgBox Session.Property("InvalidCustomInstall"), Critical Or OKOnly, Session.Property("Name")
- Exit Function
- End If
-
- End Function